package com.luojialong.model.vo.projectTb;

import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.annotation.TableId;
import com.luojialong.model.domain.ProjectTb;
import com.luojialong.utils.TimeUtils;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ProjectTbInfoVo implements Serializable {

    private static final long serialVersionUID = 472473002362964278L;
    /**
     * 这个项目的id
     */
    private Long id;

    /**
     * 这个项目的题目
     */
    private String title;

    /**
     * 所属分类
     */
    private String category;

    /**
     * 所属课程
     */
    private String lesson;

    /**
     * 提交时间
     */
    private String createTime;

    /**
     * 存储json数据的数组形式的课程实录,每一个元素对应的是一个视频的路径
     */
    private List<String> nuzhi;

    /**
     * 教案的路径
     */
    private String teachPdf;

    /**
     * 教学实施报告路径
     */
    private String expPdf;

    /**
     * 专业人才培养方案路径
     */
    private String proPdf;

    /**
     * 课程标准路径
     */
    private String lesPdf;

    /**
     * 参赛报名表路径
     */
    private String perPdf;

    /**
     * 汇总表路径
     */
    private String sumPdf;

    /**
     * 比赛情况统计表
     */
    private String tongJiPdf;


    /**
     * 是否打分(0-代表已经打分,1-代表没有打分)
     */
    private String isStore;

    /**
     * 参赛老师的Id
     */
    private Long teacherId;

    /**
     * 老师的姓名username
     */
    private String teachName;


    public static ProjectTbInfoVo transferVo(ProjectTb projectTb) {
        if (projectTb == null) {
            return null;
        }
        ProjectTbInfoVo projectTbInfoVo = new ProjectTbInfoVo();
        BeanUtils.copyProperties(projectTb, projectTbInfoVo);
        projectTbInfoVo.setCreateTime(TimeUtils.transferDateFormat(projectTb.getCreateTime()));
        projectTbInfoVo.setIsStore(projectTb.getIsStore() == 1 ? "已打分" : "未打分");
        String nuzhiStr = projectTb.getNuzhi();
        List<String> list = JSONUtil.toList(nuzhiStr, String.class);
        projectTbInfoVo.setNuzhi(list);
        return projectTbInfoVo;
    }
}
